home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / serial / callback.001 / callback~ / callback / lib / dbase / tellstate.c < prev    next >
C/C++ Source or Header  |  1996-07-30  |  946b  |  37 lines

  1.  
  2. #include "dbase.p"       
  3.  
  4. void tellstate(char *line)
  5. {
  6.     int
  7.     uid,
  8.         state;
  9.  
  10.     printf("Callback state %s: ", line);
  11.  
  12.     if (!access(filename[the_statefile], R_OK))    /* statefile exists ? */    
  13.     {    
  14.         switch (getstate(&state, &uid))
  15.         {    
  16.             case -2:          
  17.                 printf(" callback expired: ");    
  18.             /* FALLING THROUGH */    
  19.             
  20.             case -1:    
  21.             case 0:    
  22.                 printf(" ready for incoming call.\n");    
  23.             break;    
  24.                 
  25.             default:    
  26.                 printf(" calling %s (attempt %d).\n",    
  27.                 username(uid),
  28.                 get_ntries() + 1 - state);
  29.         }
  30.     }                                       /* disablefile exists ? */
  31.     else if (!access(filename[the_disablefile], R_OK))
  32.         printf(" incoming calls disabled.\n");
  33.     else
  34.         printf(" ready for incoming calls.\n");
  35. }
  36.  
  37.